import unittest
import random

def setUpModule():
    print('模块级别调用开始')

def  tearDownModule():
    print('模块级别调用结束')

def m(a,b):
    return  a+b
def my_rand():
    n = random.randint(1,6)
    return n

class S1(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        print('setUPclass被执行了')

    @classmethod
    def tearDownClass(cls):
        print('tearDownClass执行')
    def setUp(self):
        print('setUp执行')

    def tearDown(self):
        print('tearDown执行')
    def test_01(self):
        self.assertEqual(m(2,3),5)
        # print(m(2,3))

    def  test_02(self):
        self.assertEqual(m(3,5),8)
        # print(m(4,5))
    def test_03(self):
        self.assertIn(my_rand(),[1,2,3,4,5,6])
        # self.assertIn(my_rand(),[7,8])


class S2(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        print('setUPclass被执行了')

    @classmethod
    def tearDownClass(cls):
        print('tearDownClass执行')
    def setUp(self):
        print('setUp执行')

    def tearDown(self):
        print('tearDown执行')
    def test_01(self):
        print(m(2,3))

    def  test_02(self):
        print(m(4,5))